package com.easydev.faseboot.taskfilter.response;

import lombok.Data;

@Data
public class BaseResponse<T> {
    private boolean success = true;
    private String errorCode;
    private String errorMsg;
    /**
     * 一般为系统异常
     */
    private String errorDetail;
    private T data;

    public boolean error(String code, String errorMsg) {
        return error(code, errorMsg, null);
    }

    public boolean error(String code, String errorMsg, String errorDetail) {
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
        this.errorDetail = errorDetail;
        this.success = false;
        return true;
    }

    public void success(T data) {
        this.data = data;
    }
}
